

*********************************************
****   Description   ************************
*********************************************

* This program builds a figure showing the amount of deposit and the number of accounts opened in each year in the bank's history, generating "Figure 4. New Accounts Opened and Outstanding Amount of Deposits at the Freedman's Savings Bank from 1865 to 1874". 

* Source for balance due to depositors over time is from pg. 41 from the Appendix of the Select Committee to Investigate the Freedman's Savings Bank, April 2, 1880. This is part of the Investigation of the Freedman's Savings and Trust Company by the Select Committee of the Senate. 

* Source for number of accounts is account holder data. We will use a sample which excludes institutions like our final sample, however, we keep those who died prior to 1870.  


*********************************************
****   DATA *********************************
*********************************************
use "$Data/Account_Panel_Monthly_December2024.dta", clear 

* Get number of accounts opened by account open year 
gen open_year = yofd(dofm(mo_date))
collapse (sum) num_account num_account_black, by(open_year)

* Cum sum of accounts 
gen cum_sum_accs = sum(num_account)

 
*********************************************
****   Generate Figure **********************
*********************************************


* Balance due to depositors 
gen balance_due = 0 if open_year == 1865
replace balance_due =  199283.42 if open_year == 1866
replace balance_due = 366338.33 if open_year == 1867 
replace balance_due = 638299.00  if open_year == 1868 
replace balance_due = 1073465.31 if open_year == 1869 
replace balance_due = 1657006.75 if open_year == 1870 
replace balance_due = 2455836.11 if open_year == 1871 
replace balance_due =  3684739.97  if open_year == 1872
replace balance_due =3298569.21   if open_year == 1873 
replace balance_due =  2833251  if open_year == 1874
// source are: U.S. Senate. 43rd Congress, 2nd Session (1874) and U.S. Senate. 46th Congress 2nd Session (1880).



* Change units for the axis
replace balance_due = balance_due/1000

* Cumulative sum of accounts 
graph twoway (bar balance_due open_year, yaxis(2) fcolor(gs9) ///
ytitle("Balance Due in Thousands Dollars (Current)", axis(2)) ///
ylabel(0 500 1000 1500 2000 2500 3000 3500, axis(2) angle(0) format(%9.0gc))) ///
(connected cum_sum_accs open_year, mcolor(gs3) ///
ylabel(0 20000 40000 60000 80000, angle(0) nogrid format(%9.0gc)) ///
ytitle("Cumulative Sum of Accounts") ///
xlabel(1865 1866 1867 1868 1869 1870 1871 1872 1873 1874) ///
xtitle("")) ///
(scatteri 0 1874 80000 1874,  recast(line) lwidth(medthick) lpattern(dash) color(black))   ///
(scatteri 0 1869 80000 1869, recast(line) lwidth(thick) lpattern(solid) color(black)), ///
legend(order(1 "Balance Due" 2 "Cumulative Sum of Accounts")) ///
legend(region(col(white))) ///
bgcolor(white) graphregion(color(white)) plotregion(fcolor(white))


 
